package edu.upf.Ilusio.Entities;

/*
 * This class was automatically generated with 
 * <a href="http://www.castor.org">Castor 0.9.7</a>, using an XML
 * Schema.
 * $Id$
 */

  //---------------------------------/
 //- Imported classes and packages -/
//---------------------------------/

import java.io.IOException;
import java.io.Reader;
import java.io.Serializable;
import java.io.Writer;
import java.util.ArrayList;
import java.util.Enumeration;
import org.exolab.castor.xml.MarshalException;
import org.exolab.castor.xml.Marshaller;
import org.exolab.castor.xml.Unmarshaller;
import org.exolab.castor.xml.ValidationException;
import org.xml.sax.ContentHandler;

/**
 * Class User.
 * 
 * @version $Revision$ $Date$
 */
public class User implements java.io.Serializable {


      //--------------------------/
     //- Class/Member Variables -/
    //--------------------------/

    /**
     * Field _name
     */
    private java.lang.String _name;

    /**
     * Field _loginList
     */
    private java.util.ArrayList _loginList;


      //----------------/
     //- Constructors -/
    //----------------/

    public User() 
     {
        super();
        _loginList = new ArrayList();
    } //-- User()


      //-----------/
     //- Methods -/
    //-----------/

    /**
     * Method addLogin
     * 
     * 
     * 
     * @param vLogin
     */
    public void addLogin(Login vLogin)
        throws java.lang.IndexOutOfBoundsException
    {
        _loginList.add(vLogin);
    } //-- void addLogin(Login) 

    /**
     * Method addLogin
     * 
     * 
     * 
     * @param index
     * @param vLogin
     */
    public void addLogin(int index, Login vLogin)
        throws java.lang.IndexOutOfBoundsException
    {
        _loginList.add(index, vLogin);
    } //-- void addLogin(int, Login) 

    /**
     * Method clearLogin
     * 
     */
    public void clearLogin()
    {
        _loginList.clear();
    } //-- void clearLogin() 

    /**
     * Method enumerateLogin
     * 
     * 
     * 
     * @return Enumeration
     */
    public java.util.Enumeration enumerateLogin()
    {
        return new org.exolab.castor.util.IteratorEnumeration(_loginList.iterator());
    } //-- java.util.Enumeration enumerateLogin() 

    /**
     * Method getLogin
     * 
     * 
     * 
     * @param index
     * @return Login
     */
    public Login getLogin(int index)
        throws java.lang.IndexOutOfBoundsException
    {
        //-- check bounds for index
        if ((index < 0) || (index > _loginList.size())) {
            throw new IndexOutOfBoundsException();
        }
        
        return (Login) _loginList.get(index);
    } //-- Login getLogin(int) 

    /**
     * Method getLogin
     * 
     * 
     * 
     * @return Login
     */
    public Login[] getLogin()
    {
        int size = _loginList.size();
        Login[] mArray = new Login[size];
        for (int index = 0; index < size; index++) {
            mArray[index] = (Login) _loginList.get(index);
        }
        return mArray;
    } //-- Login[] getLogin() 

    /**
     * Method getLoginCount
     * 
     * 
     * 
     * @return int
     */
    public int getLoginCount()
    {
        return _loginList.size();
    } //-- int getLoginCount() 

    /**
     * Returns the value of field 'name'.
     * 
     * @return String
     * @return the value of field 'name'.
     */
    public java.lang.String getName()
    {
        return this._name;
    } //-- java.lang.String getName() 

    /**
     * Method isValid
     * 
     * 
     * 
     * @return boolean
     */
    public boolean isValid()
    {
        try {
            validate();
        }
        catch (org.exolab.castor.xml.ValidationException vex) {
            return false;
        }
        return true;
    } //-- boolean isValid() 

    /**
     * Method marshal
     * 
     * 
     * 
     * @param out
     */
    public void marshal(java.io.Writer out)
        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
    {
        
        Marshaller.marshal(this, out);
    } //-- void marshal(java.io.Writer) 

    /**
     * Method marshal
     * 
     * 
     * 
     * @param handler
     */
    public void marshal(org.xml.sax.ContentHandler handler)
        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
    {
        
        Marshaller.marshal(this, handler);
    } //-- void marshal(org.xml.sax.ContentHandler) 

    /**
     * Method removeLogin
     * 
     * 
     * 
     * @param vLogin
     * @return boolean
     */
    public boolean removeLogin(Login vLogin)
    {
        boolean removed = _loginList.remove(vLogin);
        return removed;
    } //-- boolean removeLogin(Login) 

    /**
     * Method setLogin
     * 
     * 
     * 
     * @param index
     * @param vLogin
     */
    public void setLogin(int index, Login vLogin)
        throws java.lang.IndexOutOfBoundsException
    {
        //-- check bounds for index
        if ((index < 0) || (index > _loginList.size())) {
            throw new IndexOutOfBoundsException();
        }
        _loginList.set(index, vLogin);
    } //-- void setLogin(int, Login) 

    /**
     * Method setLogin
     * 
     * 
     * 
     * @param loginArray
     */
    public void setLogin(Login[] loginArray)
    {
        //-- copy array
        _loginList.clear();
        for (int i = 0; i < loginArray.length; i++) {
            _loginList.add(loginArray[i]);
        }
    } //-- void setLogin(Login) 

    /**
     * Sets the value of field 'name'.
     * 
     * @param name the value of field 'name'.
     */
    public void setName(java.lang.String name)
    {
        this._name = name;
    } //-- void setName(java.lang.String) 

    /**
     * Method unmarshal
     * 
     * 
     * 
     * @param reader
     * @return Object
     */
    public static java.lang.Object unmarshal(java.io.Reader reader)
        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
    {
        return (User) Unmarshaller.unmarshal(User.class, reader);
    } //-- java.lang.Object unmarshal(java.io.Reader) 

    /**
     * Method validate
     * 
     */
    public void validate()
        throws org.exolab.castor.xml.ValidationException
    {
        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
        validator.validate(this);
    } //-- void validate() 

}
